package com.ycz.pattern.create.abstractfactorypattern;

import com.ycz.pattern.create.abstractfactorypattern.colorabout.Blue;
import com.ycz.pattern.create.abstractfactorypattern.colorabout.Color;
import com.ycz.pattern.create.abstractfactorypattern.colorabout.Green;
import com.ycz.pattern.create.abstractfactorypattern.colorabout.Red;
import com.ycz.pattern.create.abstractfactorypattern.shapeabout.Shape;

/**
 * @Description
 * @ClassName ColorFactory
 * @Author yanchengzhi
 * @date 2023.11.20 00:56
 */
public class ColorFactory extends AbstractFactory {
    @Override
    public Color getColor(String color) {
        if(color == null) return null;
        if("red".equalsIgnoreCase(color)) {
            return new Red();
        } else if("green".equalsIgnoreCase(color)) {
            return new Green();
        } else if("blue".equalsIgnoreCase(color)) {
            return new Blue();
        }
        return null;
    }

    @Override
    public Shape getShape(String shape) {
        return null;
    }
}
